<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Domain available checking demo page</title>
</head>
<body>
<script type="text/javascript">
	function ajaxFunction()
	{
		var id = document.demo.cur_tld_id.value;
		var xmlHttp;
		var http_query = '';
		try
		  {
		  // Firefox, Opera 8.0+, Safari
		  xmlHttp=new XMLHttpRequest();
		  }
		catch (e)
		  {
		  // Internet Explorer
		  try
		    {
		    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		    }
		  catch (e)
		    {
		    try
		      {
		      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		      }
		    catch (e)
		      {
		      alert("Your browser does not support AJAX!");
		      return false;
		      }
		    }
		  }
		var message = document.getElementById('lbl_message').innerHTML;
		xmlHttp.onreadystatechange=function()
	    {
	    	if(xmlHttp.readyState == 4){
	    		return_info = xmlHttp.responseText.split("|");
	    		if(parseInt(return_info[0]) > -1){
					if(parseInt(return_info[1]) == 1){
	    				message = message + '<b><font color=\'blue\'>' + return_info[2] + ' </font></b>';
	    				message = message + '<i>--> ' + return_info[3] + '</i>';
	    			}else{
	    				message = message + '<b><font color=\'red\'>' + return_info[2] + ' </font></b>';
	    				message = message + '<i>--> ' + return_info[3] + '</i>';
	    				message = message + '. <u>Registrar:</u>' + return_info[4] ;
	    			}
	    			message = message + '<br>';
	    			document.getElementById('lbl_message').innerHTML = message;
	    			document.demo.cur_tld_id.value = return_info[0];
	    			ajaxFunction();
	    		}else{
	    			message = message + '<b>Finish checking</b>';
	    			document.getElementById('lbl_message').innerHTML = message;
	    			document.demo.cur_tld_id.value = 0;
	    			return;
	    		}
	    	}
	    }
	  //send the request
	  	xmlHttp.open("POST","dom_search.php", true);
	   	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    	xmlHttp.setRequestHeader("Connection", "close");
	  	http_query = 'dom_to_check=' + document.demo.dom_to_check.value;
	  	http_query = http_query + '&tld_id=' + parseInt(id);
	   	xmlHttp.setRequestHeader("Content-length", http_query.length);
	  	xmlHttp.send(http_query);
	 }

</script>
<form name="demo">
<input type="hidden" id='cur_tld_id' name='cur_tld_id' value='0' />
<table align="center" cellpadding="3" cellspacing="0" width="40%">
	<tr>
		<td><label for="dom_to_check">Domain to check: </label></td><td><input type="text" size="20px" id="dom_to_check" name="dom_to_check"></td>
	</tr>
	<tr>
		<td colspan="2" align="center"><input type="button" value="Check" onclick="document.getElementById('lbl_message').innerHTML='<b>Start checking domain ...</b><br>';ajaxFunction();"></td>
	</tr>
</table>
</form>
<label id="lbl_message" name="lbl_message"></label>
</body>
</html>